<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>会员卡号
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="card" name="username" required="" lay-verify="required"
                          autocomplete="off" class="layui-input" value="{$member.card}">
                      </div>

                  </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>姓名
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name="username" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input" value="{$member.name}">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>性别</label>
                        <div class="layui-input-inline">
                            <select name="shipping" class="valid" id="sex">
                                {if $member.sex == '1'}
                                    <option value="1">男</option>
                                {else /}
                                    <option value="0">女</option>
                                {/if}
                                <option value="0">女</option>
                                <option value="1">男</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>手机号
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="tel" name="username" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input" value="{$member.tel}">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>身份证
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="identity" name="username" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input" value="{$member.identity}">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>会员类型</label>
                        <div class="layui-input-inline">
                            <select name="shipping" class="valid" id="type">
                                <option value="{$viptype.id}">{$viptype.vipname}</option>
                                {volist name="list" id="vo"}
                                    <option value="{$vo.id}">{$vo.vipname}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" type="button" onclick="adds()">
                          增加
                      </button>
                  </div>
              </form>
            </div>
        </div>

    </body>
<script>
    layui.use(['form', 'layer'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                        layer = layui.layer;
            });
    function adds(){
        $.ajax({
            type:"post",
            url: "{:url('home/member/data_edit')}",
            data: {
                id:{$member.id},
                card:$('#card').val(),
                name:$('#name').val(),
                sex:$('#sex').val(),
                tel:$('#tel').val(),
                identity:$('#identity').val(),
                type:$('#type').val()
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>

</html>
